home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3775 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Unbuffered character input...
  5. Date: 30 Jan 1996 07:33:09 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4eldnlINNc9f@keats.ugrad.cs.ubc.ca>
  8. References: <Pine.SGI.3.91.960129190205.27936A-100000@tahiti.cs.unm.edu>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <Pine.SGI.3.91.960129190205.27936A-100000@tahiti.cs.unm.edu>,
  12. Caleb Haley  <chaley@tahiti.cs.unm.edu> wrote:
  13. >Greetings!
  14. >
  15. >Just curious--is there a way to do unbuffered character input in c?
  16. >i.e.  getting just one character without waiting for a carriage return 
  17. >(enter)...
  18.  
  19. No. You set this up with OS-specific system calls. The C language has no
  20. built-in input or output methods. The standard C library is not powerful enough
  21. to take advantage of all the various OS features that are out there.
  22.  
  23. >Any help is appreciated :)
  24. >
  25. >----==-- CHaley: chaley@possibility.zynet.com, chaley@cs.unm.edu
  26. >---==--- HOME:+1.505.292.4246
  27. >--==---- Possibility Systems:custom system design(http://www.zynet.com/~possys
  28. >-======- Proud Linux system administrator. The choice of a GNU generation. 
  29.  
  30. If you are using Linux, learn about controlling terminal characteristics with
  31. the POSIX termio functions. The Advanced Programming in the UNIX Environment
  32. text discusses this in detail, I believe.
  33.  
  34. You can put the terminal driver in a mode such that it delivers individual
  35. characters to a read() request, instead of processing lines.  Or you can use
  36. curses, which cushions you from having to talk to the terminal device driver
  37. directly.
  38.  
  39. If you use X, you simply process keypress and keyrelease events coming from the
  40. X display server, which gives you a lot more flexibility.
  41. -- 
  42.  
  43.